package com.ssyc.common.http;

import android.text.TextUtils;
import android.util.Log;

import com.ssyc.common.base.BaseApplication;
import com.ssyc.common.bean.GroupInfo;
import com.ssyc.common.utils.GsonUtil;
import com.ssyc.common.utils.UiUtils;

import java.util.HashMap;
import java.util.Map;

import okhttp3.Call;

/**
 * 请求的群组
 * Created by Administrator on 2018/8/13 0013.
 */

public class HttpTeam {

    /**
     * 请求群成员的接口
     */
    public static void httpGroupInfos(String acc, String role, final String groupId, String tid) {
        Map<String, String> map = new HashMap<>();
        map.put("type", "24");
        map.put("c", acc);
        map.put("role", role);
        map.put("groupid", groupId);
        map.put("tid", tid);
        map.put("platform", "8");

        HttpUtils.post(HttpAdress.GROUPINFOS, map, null, new HttpUtils.CallBack() {
            @Override
            public void onError(Call call, Exception e, int id) {
                UiUtils.Toast(BaseApplication.ERROR, false);
            }

            @Override
            public void onResponse(String response, int id) {
                if (!TextUtils.isEmpty(response)) {
                    GroupInfo groupInfo = null;
                    try {
                        groupInfo = GsonUtil.jsonToBean(response, groupInfo.getClass());
                    } catch (Exception e) {
                        Log.i("test", "数据解析异常");
                    }
                }
            }
        });

    }
}
